package com.game.gm.message;

import game.message.Message;
import org.apache.log4j.Logger;
import org.apache.mina.core.buffer.IoBuffer;

public class ReqGMCommMessage extends Message {
	private static Logger log = Logger.getLogger(ReqGMCommMessage.class);
	public static final String MSGTYPE = "CS";
	private String comm;

	public boolean write(IoBuffer buf) {
		try {
			writeString(buf, this.comm);
		} catch (Exception e) {
			log.error(e, e);
			return false;
		}
		return true;
	}

	public boolean read(IoBuffer buf) {
		try {
			this.comm = readString(buf);
		} catch (Exception e) {
			log.error(e, e);
			return false;
		}
		return true;
	}

	public String getComm() {
		return this.comm;
	}

	public void setComm(String comm) {
		this.comm = comm;
	}

	public int getId() {
		return 203101;
	}

	public String toString() {
		StringBuffer buf = new StringBuffer("[");

		if (this.comm != null)
			buf.append("comm:" + this.comm.toString() + ",");
		if (buf.charAt(buf.length() - 1) == ',')
			buf.deleteCharAt(buf.length() - 1);
		buf.append("]");
		return buf.toString();
	}

	public String getQueue() {
		return null;
	}

	public String getServer() {
		return null;
	}
}